package cn.cnsuh.剑指offer.q63_股票的最大利润;

public class Main {

     int maxProfit(int[] prices) {
        int cost = Integer.MAX_VALUE;
        int profit = 0;
        for(Integer price : prices){
            cost = Math.min(cost , price);
            profit = Math.max(profit,price - cost);
        }
        return profit;
    }
}
